<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>tango.core.ByteSwap</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "tango.core.ByteSwap";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/tango.core.ByteSwap.html" class="symbol">tango.core.ByteSwap</a></h1>
  
<p class="sec_header">License:</p>BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a>
<p class="sec_header">Version:</p>Initial release: October 2004
<p class="sec_header">Version:</p>Feb 20th 2005 - Asm version removed by Aleksey Bobnev
<p class="sec_header">Author:</p>Kris, Aleksey Bobnev
<dl>
<dt class="decl">struct <a class="symbol _struct" name="ByteSwap" href="./htmlsrc/tango.core.ByteSwap.html#L34" kind="struct" beg="34" end="188">ByteSwap</a>; <a title="Permalink to this symbol" href="#ByteSwap" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L34">#</a></dt>
<dd class="ddef">
<div class="summary">Reverse byte order for specific datum sizes. Note that the
        byte-swap approach avoids alignment issues, so is probably
        faster overall than a traditional 'shift' implementation.
        <pre class="d_code">
<p class="error L">tango.core.ByteSwap(3,33)L: digits 8 and 9 are not allowed in octal numbers.</p>
<p class="error L">tango.core.ByteSwap(4,27)L: digits 8 and 9 are not allowed in octal numbers.</p>
<p class="error L">tango.core.ByteSwap(5,15)L: digits 8 and 9 are not allowed in octal numbers.</p>
<span class="k">ubyte</span>[] <span class="i">x</span> = [<span class="n">0x01</span>, <span class="n">0x02</span>, <span class="n">0x03</span>, <span class="n">0x04</span>, <span class="n">0x05</span>, <span class="n">0x06</span>, <span class="n">0x07</span>, <span class="n">0x08</span>];

<span class="i">swap16</span> (<span class="i">x</span>) =&gt; <span class="n">02</span> <span class="n">01</span> <span class="n">04</span> <span class="n">03</span> <span class="n">06</span> <span class="n">05</span> <span class="n">08</span> <span class="n">07</span>     
<span class="i">swap32</span> (<span class="i">x</span>) =&gt; <span class="n">04</span> <span class="n">03</span> <span class="n">02</span> <span class="n">01</span> <span class="n">08</span> <span class="n">07</span> <span class="n">06</span> <span class="n">05</span>
<span class="i">swap64</span> (<span class="i">x</span>) =&gt; <span class="n">08</span> <span class="n">07</span> <span class="n">06</span> <span class="n">05</span> <span class="n">04</span> <span class="n">03</span> <span class="n">02</span> <span class="n">01</span>
</pre></div>
<dl>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap16" href="./htmlsrc/tango.core.ByteSwap.html#L43" kind="function" beg="43" end="46">swap16</a><span class="params">(void[] <em>dst</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap16" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L43">#</a></dt>
<dd class="ddef">
<div class="summary">Reverses two-byte sequences. Parameter dst imples the 
                number of bytes, which should be a multiple of 2</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap32" href="./htmlsrc/tango.core.ByteSwap.html#L55" kind="function" beg="55" end="58">swap32</a><span class="params">(void[] <em>dst</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap32" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L55">#</a></dt>
<dd class="ddef">
<div class="summary">Reverses four-byte sequences. Parameter dst implies the  
                number of bytes, which should be a multiple of 4</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap64" href="./htmlsrc/tango.core.ByteSwap.html#L67" kind="function" beg="67" end="70">swap64</a><span class="params">(void[] <em>dst</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap64" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L67">#</a></dt>
<dd class="ddef">
<div class="summary">Reverse eight-byte sequences. Parameter dst implies the 
                number of bytes, which should be a multiple of 8</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap80" href="./htmlsrc/tango.core.ByteSwap.html#L79" kind="function" beg="79" end="82">swap80</a><span class="params">(void[] <em>dst</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap80" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L79">#</a></dt>
<dd class="ddef">
<div class="summary">Reverse ten-byte sequences. Parameter dst implies the 
                number of bytes, which should be a multiple of 10</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap16:2" href="./htmlsrc/tango.core.ByteSwap.html#L91" kind="function" beg="91" end="105">swap16</a><span class="params">(void * <em>dst</em>, uint <em>bytes</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap16:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L91">#</a></dt>
<dd class="ddef">
<div class="summary">Reverses two-byte sequences. Parameter bytes specifies the 
                number of bytes, which should be a multiple of 2</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap32:2" href="./htmlsrc/tango.core.ByteSwap.html#L114" kind="function" beg="114" end="125">swap32</a><span class="params">(void * <em>dst</em>, uint <em>bytes</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap32:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L114">#</a></dt>
<dd class="ddef">
<div class="summary">Reverses four-byte sequences. Parameter bytes specifies the  
                number of bytes, which should be a multiple of 4</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap64:2" href="./htmlsrc/tango.core.ByteSwap.html#L134" kind="function" beg="134" end="148">swap64</a><span class="params">(void * <em>dst</em>, uint <em>bytes</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap64:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L134">#</a></dt>
<dd class="ddef">
<div class="summary">Reverse eight-byte sequences. Parameter bytes specifies the 
                number of bytes, which should be a multiple of 8</div></dd>
<dt class="decl">void <a class="symbol _function" name="ByteSwap.swap80:2" href="./htmlsrc/tango.core.ByteSwap.html#L157" kind="function" beg="157" end="187">swap80</a><span class="params">(void * <em>dst</em>, uint <em>bytes</em>)</span>; <span class="attrs">[<span class="stc">static</span>, <span class="stc">final</span>]</span> <a title="Permalink to this symbol" href="#ByteSwap.swap80:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.core.ByteSwap.html#L157">#</a></dt>
<dd class="ddef">
<div class="summary">Reverse ten-byte sequences. Parameter bytes specifies the 
                number of bytes, which should be a multiple of 10</div></dd></dl></dd></dl>
</div>
<div id="footer">
  <p>Copyright (c) 2004 Kris Bell. All rights reserved</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Fri Dec 26 04:04:03 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>